﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
using UCL.Powersource.TFS;

namespace UCL.Powersource.Mock
{
    [DataContract]
    public class DummyTfsTeamProjectCollectionFactory : ITfsTeamProjectCollectionFactory
    {
        [IgnoreDataMember]
        private Dictionary<Uri, DummyTfsTeamProjectCollection> Cache;

        public ITfsTeamProjectCollection GetTeamProjectCollection(Uri uri)
        {
            if (Cache == null) Cache = new Dictionary<Uri, DummyTfsTeamProjectCollection>();

            if (!Cache.ContainsKey(uri))
            {
                Cache.Add(uri, new DummyTfsTeamProjectCollection(uri));
            }

            return Cache[uri];
        }
    }


}
